//-----------------------------------------------------------------------

// <copyright file="CalendarFieldDefinition.cs" company="Jamie Knight">

// Copyright (c) Jamie Knight. All rights reserved.

// </copyright>

//-----------------------------------------------------------------------

using System.Windows.Controls;
using System.Windows.Data;

namespace DevKnightlie.WPF.AutoForm.FieldDefinitions
{
    /// <summary>
    /// Field Definition subclass which builds a Calendar control
    /// </summary>
    public class CalendarFieldDefinition: BaseFieldDefinition
    {

        public override void BuildInputControl()
        {
            Calendar cal = new Calendar();
            Binding calBinding = new Binding(PropertyName);
            BindingOperations.SetBinding(cal, Calendar.DisplayDateProperty, calBinding);
            SetupEnabledBinding(cal);
            ContainerControl = InputControl = cal;
        }

    }
}
